package core;

public class Process 
{
	private Program program;
	private Memory memory;
	int instructionPointer;

	public Process(Memory memory)
	{
		this.memory = memory;
	}
	
	public void setProgram(Program program)
	{
		this.program = program;
	}
	
	public int getInstructionPointer() 
	{
		return instructionPointer;
	}

	public void setInstructionPointer(int i) 
	{
		this.instructionPointer = i;
	}
	
	public void execute()
	{
		memory.getInstruction(instructionPointer).execute(this);
		instructionPointer = memory.standardizeAddres(instructionPointer);
	}

	public void kill() 
	{
		program.removeProcess(this);
	}
}
